package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConst;
import com.itheima.entity.Result;
import com.itheima.service.MemberService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/member")
public class MmeberController {

    @Reference
    MemberService memberService;

    @RequestMapping("/getmemberReport")
    public Result getmemberReport(){
        try{
            return new Result(true, "查询成功",memberService.findBySex());
        }catch (Exception e){
            return new Result(false,"服务器出错");
        }
    }

    @RequestMapping("/getmemberReportByAge")
    public Result getmemberReportByAge(){
        try{
            return new Result(true, "查询成功",memberService.findByAge());
        }catch (Exception e){
            return new Result(false,"服务器出错");
        }
    }
}
